﻿using System;
using nRoute.Components.Routing;
using nRoute.Utilities;

namespace nRoute.Mapping
{
	public class DefaultNavigationFileLocator
		 : DefaultNavigationLocatorBase
	{
        private readonly string _filePath;

        public DefaultNavigationFileLocator(string url, string filePath)
            : base(url)
        {
            Guard.ArgumentNotNullOrWhiteSpace(filePath, "filePath");
            _filePath = filePath;
        }

        public string FilePath
        {
            get { return _filePath; }
        }

#region Overrides
        
        protected override IRouteHandler CreateRouteHandler(Components.Composition.ITypeBuilder typeBuilder)
        {
            // note this is always relative - as WP7 can't use a absolute path for navigation
			return new NavigationFileHandler(new Uri(this.FilePath, UriKind.Relative));
		}
		
#endregion

	}
}